<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2021/10/22
 * Time: 16:05
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\common\model\mysql;

use app\common\lib\Status;

class Comment extends Base
{
    public function getCommentList(int $theatre_id = 0,int $type = 0)
    {
        return $this->field("*,openid as get_openid_user")
            ->where('theatre_id', $theatre_id)
            ->where('type',$type)
            ->order('id desc')
            ->select()->toArray();
    }

    protected function getGetOpenidUserAttr($value)
    {
        $user = (new Wechat())->getWechatByOpenid($value);
        return $user ?? [];
    }
}